<?php
/**
 * Created by PhpStorm.
 * User: gzc0918
 * Date: 2021-08-08
 * Time: 21:21
 */

namespace IMooc;

//颜色装饰器
class ColorDrawDecorator implements DrawDecorator
{
    protected $color;
    public function __construct($color = 'red')
    {
        $this->color = $color;
    }

    function beforeDraw()
    {
        echo "<div style='color:{$this->color}'>";
    }
    function afterDraw()
    {
        echo "</div>";
    }
}